<?=plugin\laoha\app\common\Template::header($title??'老蟹CMS')?>
<?=plugin\laoha\app\common\Template::nav('default',$active??'/')?>
<div class="container py-3 pb-0">
    <?=plugin\laoha\app\common\Template::bread($bread??'')?>
</div>
<div class="container">
    <div class="row">
        <div class="col-lg-8 mb-4">

            <?php foreach($data['items'] as $item){ ?>
            <div class="card shadow-sm mb-3 rounded-0">
                <div class="row g-0">
                    <div class="col-sm-4 col-xl-3">
                        <a href="<?=$item['cover']?>" class="image-link" title="<?=htmlspecialchars($item['title'])?>"><img src="<?=laoha_thumb($item['cover'],300,240)?>" class="img-fluid w-100"></a>
                    </div>
                    <div class="col-sm-8 col-xl-9 d-flex flex-column ps-2">
                        <div class="card-body">

                            <h5 class="card-title text-truncate">
                                <a class="link-underline-light link-dark"
                                    href="/app/laoha/post/detail?id=<?=$item['id']?>">
                                    <?=htmlspecialchars($item['title'])?>
                                </a>
                            </h5>
                            <p class="card-text  text-muted fw-light">
                                <small>
                                    分类：<a class="link-underline-light"
                                        href="/app/laoha/post?cate_id=<?=$item['cate_id']?>">
                                        <?=$item['cate']['title']?>
                                    </a>
                                    &nbsp;&nbsp;&nbsp;&nbsp;
                                    <?=$item['group']?'分组：':''?>
                                    <a class="link-underline-light" href="/app/laoha/post?cate_id=<?=$item['cate_id']?>&group=<?=$item['group']?>">
                                        <?=$item['group']?>
                                    </a>
                                </small>
                            </p>
                        </div>

                        <div class="px-3">
                            <p class="fs-6 fw-lighter text-muted"><i class="far fa-clock"></i>
                                <?=timeTo($item['created_at'])?>&nbsp;&nbsp;&nbsp;&nbsp;<i
                                    class="far fa-paper-plane"></i>
                                <?=$item['views']?> 阅读
                                <?=isset($item['comments_count']) ?  '&nbsp;&nbsp;&nbsp;&nbsp;<i class="far fa-comment-dots"></i> '.$item['comments_count'].' 评论' : '' ?>
                            </p>
                        </div>
                    </div>

                </div>
            </div>
            <?php } ?>
            <?=plugin\laoha\app\common\Template::page($data)?>
        </div>
        <div class="col-lg-4 mb-4">
            <div class="card shadow-sm mb-4 p-3 rounded-0">
                <div class="fw-bolder fs-5">文章搜索</div>
                <?=plugin\laoha\app\common\Template::search()?>
            </div>
            <div class="card shadow-sm mb-4 p-3 rounded-0">
                <div class="fw-bolder fs-5 mb-3">
                    分类选择
                </div>
                <?=plugin\laoha\app\common\Template::cate('post')?>
            </div>
        </div>
    </div>
</div>
<?=plugin\laoha\app\common\Template::footer()?>